Skip to content

feat(2.0): seroval json mode#2042

Merged
atilafassina merged 23 commits intomainfrom
feat-seroval-json
Feb 25, 2026
Merged

feat(2.0): seroval json mode#2042
atilafassina merged 23 commits intomainfrom
feat-seroval-json

Conversation

@lxsmnsyc
Copy link
Member

@lxsmnsyc lxsmnsyc commented Jan 4, 2026

Pretty straight forward. Adds an opt-in mode to use json mode (set by default) for seroval streaming, this is because the js stream is affected by CSP.

Also adds streaming support for client-to-server communication (except for url-encoded requests), assuming that the browser it comes from supports it.

@changeset-bot
Copy link

changeset-bot bot commented Jan 4, 2026

🦋 Changeset detected

Latest commit: 0e31479

The changes in this PR will be included in the next version bump.

Not sure what this means? Click here to learn what changesets are.

Click here if you're a maintainer who wants to add another changeset to this PR

@netlify
Copy link

netlify bot commented Jan 4, 2026

Deploy Preview for solid-start-landing-page ready!

Name Link
🔨 Latest commit 0e31479
🔍 Latest deploy log https://app.netlify.com/projects/solid-start-landing-page/deploys/699ed3ff9be69e000891cad6
😎 Deploy Preview https://deploy-preview-2042--solid-start-landing-page.netlify.app
📱 Preview on mobile
Toggle QR Code...

QR Code

Use your smartphone camera to open QR code link.

To edit notification comments on pull requests, go to your Netlify project configuration.

@pkg-pr-new
Copy link

pkg-pr-new bot commented Jan 4, 2026

Open in StackBlitz

npm i https://pkg.pr.new/solidjs/solid-start/@solidjs/start@2042
npm i https://pkg.pr.new/solidjs/solid-start/@solidjs/vite-plugin-nitro-2@2042

commit: 0e31479

@lxsmnsyc lxsmnsyc mentioned this pull request Jan 4, 2026
@lxsmnsyc lxsmnsyc changed the title feat: seroval json mode feat(2.0): seroval json mode Jan 14, 2026
@katywings
Copy link
Contributor

Testing this branch on my project and uploading files through formData via https://github.com/hattipjs/hattip/tree/main/packages/base/multipart results in the following error 🙈:
[unhandledRejection] Error: Invalid content type

The error is throwed at this line: https://github.com/hattipjs/hattip/blob/15aa5ae4dec4478aa07785c85b2c85d4a753d0af/packages/base/multipart/src/form-data.ts#L79

It looks like with the changes in this branch, the upload doesn't set proper multipart boundaries anymore 🤔. The condition leading to the throw is !match.directives.boundary (https://github.com/hattipjs/hattip/blob/15aa5ae4dec4478aa07785c85b2c85d4a753d0af/packages/base/multipart/src/form-data.ts#L77C3-L77C29) - meaning: the content-type header misses the boundary flag 😅. E.g. the header should look as something like:

Content-Type: multipart/form-data; 
          boundary=gc0p4Jq0M2Yt08jU534c0p

(Reference: https://www.w3.org/Protocols/rfc1341/7_2_Multipart.html)

@lxsmnsyc
Copy link
Member Author

Seemed like explicit definition of multipart/form-data overrides the derived content-type fetch does under the hood. Anyways fixed

@brenelz
Copy link
Contributor

brenelz commented Feb 8, 2026

Whats the latest on this pr?

@lxsmnsyc
Copy link
Member Author

lxsmnsyc commented Feb 9, 2026

@brenelz nothing much, but I haven't tested since the last commit lol

Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR introduces a new Seroval serialization layer for server functions with an opt-in response mode (js vs json, defaulting to json) to improve CSP compatibility, and expands the server-function transport to support more body types.

Changes:

  • Bumped seroval / seroval-plugins to ^1.5.0.
  • Added a new serialization module plus shared body-format helpers to support JS-stream vs JSON-stream response deserialization and additional body types (FormData, File, Blob, ArrayBuffer, Uint8Array, etc.).
  • Added new e2e/demo routes and tests for server-function round trips.

Reviewed changes

Copilot reviewed 11 out of 12 changed files in this pull request and generated 16 comments.

Show a summary per file
File Description
pnpm-lock.yaml Updates lockfile for seroval/seroval-plugins upgrade.
packages/start/package.json Bumps seroval and seroval-plugins dependency ranges.
packages/start/src/config/index.ts Adds serialization.mode option and injects SEROVAL_MODE define.
packages/start/src/server/serialization.ts Introduces streaming serializer/deserializer utilities for JS and JSON modes.
packages/start/src/server/server-functions-shared.ts Adds body-format header constants + helpers for encoding/decoding request/response bodies.
packages/start/src/server/server-runtime.ts Updates client runtime to use the new serialization/body extraction helpers.
packages/start/src/server/server-functions-handler.ts Updates server handler to use the new serialization + body extraction helpers.
apps/tests/src/routes/server-function-ping.tsx Adds a basic server-function route for testing.
apps/tests/src/routes/server-function-form-data.tsx Adds a FormData/File server-function route for testing.
apps/tests/src/routes/server-function-blob.tsx Adds a Blob server-function route for testing.
apps/tests/src/e2e/server-function.test.ts Adds new e2e tests for ping and FormData server functions.
.changeset/plenty-geese-enter.md Adds changeset entry for the feature.
Files not reviewed (1)
  • pnpm-lock.yaml: Language not supported

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

@atilafassina atilafassina enabled auto-merge (squash) February 25, 2026 16:47
@atilafassina atilafassina merged commit f6f0452 into main Feb 25, 2026
10 checks passed
@atilafassina atilafassina deleted the feat-seroval-json branch February 25, 2026 16:48
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

6 participants